**********************************************
***** Robustness Check with other issues *****
**********************************************
clear
set more off
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"


/*Gay Marriage Robustness Check*/


ologit gaymar_self pid libconN incomeI educN moraltrad interestN i.gender c.attendchurch c.retrospect c.ageN unemp disthispanicpct_10_MC hd0010_MC i.newdest1 i.border c.rprigaymar_MC##i.newdest1 c.dprigaymar if race==1  [pw=v102], cluster(state)
 
 margins, at(c.rprigaymar=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot


matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold gay7, replace
drop if newdest==0
saveold gay7nd, replace

clear
use gay7
drop if newdest==1
saveold gay7nnd, replace

clear

use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"



ologit health_self pid libconN incomeI educN moraltrad interestN i.gender c.attendchurch c.retrospect c.ageN unemp disthispanicpct_10_MC hd0010_MC i.newdest1 i.border c.rprihealth_MC##i.newdest1 c.dprihealth_MC if race==1  [pw=v102], cluster(state)
 
 margins, at(c.rprihealth=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	
	

matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold health7, replace
drop if newdest==0
saveold health7nd, replace

clear
use health7
drop if newdest==1
saveold health7nnd, replace

clear

use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"



ologit tax_self pid libconN incomeI educN moraltrad interestN i.gender c.attendchurch c.retrospect c.ageN unemp disthispanicpct_10_MC hd0010_MC i.newdest1 i.border c.rpritax_MC##i.newdest1 c.dpritax_MC if race==1  [pw=v102], cluster(state)
 
 margins, at(c.rpritax=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	
	

matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold tax7, replace
drop if newdest==0
saveold tax7nd, replace

clear
use tax7
drop if newdest==1
saveold tax7nnd, replace

clear
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"

/*Treating Immigration Opinion as a Function of Gay Marriage, Health Care, and Tax Policy*/

/*Gay*/
ologit immig_self_whole pid libconN incomeI educN moraltrad interestN i.gender c.attendchurch c.retrospect c.ageN i.gender c.attendchurch c.retrospect c.ageN unemp disthispanicpct_10_MC hd0010_MC i.newdest1 i.border c.rprigaymar_MC##i.newdest1 c.dprigaymar_MC if race==1  [pw=v102], cluster(state)

margins, at(c.rprigaymar=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	
	

matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold gayimm7, replace
drop if newdest==0
saveold gayimm7nd, replace

clear
use gayimm7
drop if newdest==1
saveold gayimm7nnd, replace




clear
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"



/*Health*/



ologit immig_self_whole pid libconN incomeI educN moraltrad interestN i.gender c.attendchurch c.retrospect c.ageN unemp disthispanicpct_10_MC hd0010_MC i.newdest1 i.border c.rprihealth_MC##i.newdest1 c.dprihealth_MC if race==1 [pw=v102], cluster(state)
 
 margins, at(c.rprihealth=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot


matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold healthimm7, replace
drop if newdest==0
saveold healthimm7nd, replace

clear
use healthimm7
drop if newdest==1
saveold healthimm7nnd, replace

clear
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"



ologit immig_self_whole pid libconN incomeI educN moraltrad interestN i.gender c.attendchurch c.retrospect c.ageN unemp disthispanicpct_10_MC hd0010_MC i.newdest1 i.border c.rpritax_MC##i.newdest1 c.dpritax_MC if race==1 [pw=v102], cluster(state)
 
 margins, at(c.rpritax=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	
	

matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold taximm7, replace
drop if newdest==0
saveold taximm7nd, replace

clear
use taximm7
drop if newdest==1
saveold taximm7nnd, replace


clear
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"


/********************************************************/
/*Treating Alternative Items as a Function of Immig Cues*/

/*Gay*/

ologit gaymar_self c.pid c.libconN c.incomeI c.educN c.moraltrad c.interestN i.gender c.attendchurch c.retrospect c.ageN c.unemp c.disthispanicpct_10_MC c.hd0010_MC i.border i.newdest1 c.rep_priority_MC##i.newdest1 c.dem_priority_MC if race==1 [pw=v102], cluster(state) 


margins, at(c.rep_priority_MC=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	
	

matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold Dgayimm7, replace
drop if newdest==0
saveold Dgayimm7nd, replace

clear
use Dgayimm7
drop if newdest==1
saveold Dgayimm7nnd, replace

clear


use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"


/*Health*/



ologit health_self c.pid c.libconN c.incomeI c.educN c.moraltrad c.interestN i.gender c.attendchurch c.retrospect c.ageN c.unemp c.disthispanicpct_10_MC c.hd0010_MC i.border i.newdest1 c.rep_priority_MC##i.newdest1 c.dem_priority_MC if race==1 [pw=v102], cluster(state) 


margins, at(c.rep_priority_MC=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	


matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold Dhealthimm7, replace
drop if newdest==0
saveold Dhealthimm7nd, replace

clear
use Dhealthimm7
drop if newdest==1
saveold Dhealthimm7nnd, replace


clear
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"

/*Tax*/

ologit tax_self c.pid c.libconN c.incomeI c.educN c.moraltrad c.interestN i.gender c.attendchurch c.retrospect c.ageN c.unemp c.disthispanicpct_10_MC c.hd0010_MC i.border i.newdest1 c.rep_priority_MC##i.newdest1 c.dem_priority_MC if race==1 [pw=v102], cluster(state) 


margins, at(c.rep_priority_MC=(-1(.1)1) border=(0) newdest=(1,0)) predict(outcome(7)), if e(sample)
    marginsplot
	
	

matrix pr=r(b)' 
matrix var=vecdiag(r(V))'
drop * 
svmat pr  
svmat var
g se=sqrt(var)
gen obs=_n
gen contrast=7
gen newdest=1 if obs <= 21
replace newdest=0 if newdest==.
saveold Dtaximm7, replace
drop if newdest==0
saveold Dtaximm7nd, replace

clear
use Dtaximm7
drop if newdest==1
saveold Dtaximm7nnd, replace


clear
use "/Users/bsjjones/Dropbox/JoestenJones/PB R&R/microdata_R_revised_October.dta"

